package com.kim.authorization.server.controller;

import com.kim.authorization.server.dto.ClientsDTO;
import com.kim.authorization.server.service.MyBatisClientDetailsServiceImpl;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * Client管理Controller
 */
@RestController
public class ClientsController {

    /**
     * 客户端Service
     */
    private final MyBatisClientDetailsServiceImpl myBatisClientDetailsServiceImpl;

    public ClientsController(MyBatisClientDetailsServiceImpl myBatisClientDetailsServiceImpl) {
        this.myBatisClientDetailsServiceImpl = myBatisClientDetailsServiceImpl;
    }

    /**
     * 新增客户端
     *
     * @param clients 新增客户端内容
     */
    @PostMapping("oauth/client/insert")
    public Object insert(@Valid @RequestBody ClientsDTO clients) {
        return myBatisClientDetailsServiceImpl.insert(clients);
    }

}

